When you’re selling and rebuying stocks, it’s important to understand the wash sale rule and avoid having losses disallowed by the IRS.